package com.qf.commons.event.config;

import com.qf.commons.event.core.handle.DefaultConsumerStandrad;
import com.qf.commons.event.core.handle.DefaultProduceStandrad;
import com.qf.commons.event.mq.kafka.config.KafkaAutoConfiguration;
import com.qf.commons.event.mq.rabbitmq.config.RabbitMqAutoConfiguration;
import com.qf.commons.event.mq.standrad.CoreMqProduceStandard;
import com.qf.commons.event.mq.standrad.MqProduceStandard;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * 自动装配的类
 * description:
 * author: Ken
 * 公众号：Java架构栈
 */
@Configuration
@ComponentScan("com.qf.commons.event.**.interceptor")
@AutoConfigureAfter({KafkaAutoConfiguration.class, RabbitMqAutoConfiguration.class})
public class EventAutoConfiguration {

    @Bean
    public DefaultConsumerStandrad getDefaultConsumerStandrad(){
        return new DefaultConsumerStandrad();
    }

    @Bean
    public DefaultProduceStandrad getDefaultProduceStandrad(){
        return new DefaultProduceStandrad();
    }

    @Bean
    @Primary
    public MqProduceStandard getCoreMqProduceStandard(){
        return new CoreMqProduceStandard();
    }
}
